package net.hn.hnms.biz.safety.wind.Service;

import net.hn.hnms.biz.safety.wind.Dao.WindResistanceDao;
import net.hn.hnms.biz.safety.wind.entity.WindResistanceEntity;
import net.hn.hnms.biz.safety.wind.entity.WindResistanceVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 智呈物联 nzw
 * @date 2022/12/21
 */
@Service
public class WindResistanceService {

    private WindResistanceDao windResistanceDao;

    @Autowired
    public void setWindResistanceDao(WindResistanceDao windResistanceDao) {
        this.windResistanceDao = windResistanceDao;
    }

    public List<WindResistanceVO> findWindResistance(String mineCode){
        List<WindResistanceEntity> windResistanceEntityList = windResistanceDao.findAllByMineCode(mineCode);
        List<WindResistanceVO> list = new ArrayList<>();
        for(WindResistanceEntity windResistance: windResistanceEntityList){
            WindResistanceVO windResistanceVO = new WindResistanceVO();
            windResistanceVO.setId(windResistance.getId());
            windResistanceVO.setTunnelName(windResistance.getTunnelName());
            windResistanceVO.setAirResistance(windResistance.getAirResistance());
            windResistanceVO.setAirVolume(windResistance.getAirVolume());
            windResistanceVO.setFrictionResistanceCoefficient(windResistance.getFrictionResistanceCoefficient());
            windResistanceVO.setLastNormalVentilationResistance(windResistance.getLastNormalVentilationResistance());
            windResistanceVO.setVentilationResistance(windResistance.getVentilationResistance());

            list.add(windResistanceVO);
        }
        return list;
    }
}
